﻿<!--<SnippetSource>-->
<Window x:Class="sample.Window1"
  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  xmlns:local="clr-namespace:sample"
  Title="Binding to a Collection"
  SizeToContent="WidthAndHeight" Width="577.5" Height="417.5">
  <Window.Resources>
    <local:People x:Key="MyFriends"/>
    <!--</SnippetSource>-->
    <Style TargetType="ListBoxItem">
      <Setter Property="FontFamily" Value="Verdana"/>
      <Setter Property="FontSize" Value="11"/>
      <Setter Property="Padding" Value="10"/>
    </Style>
    <!--<SnippetDetailTemplate>-->
    <DataTemplate x:Key="DetailTemplate">
      <Border Width="300" Height="100" Margin="20"
              BorderBrush="Aqua" BorderThickness="1" Padding="8">
        <Grid>
          <Grid.RowDefinitions>
            <RowDefinition/>
            <RowDefinition/>
            <RowDefinition/>
          </Grid.RowDefinitions>
          <Grid.ColumnDefinitions>
            <ColumnDefinition/>
            <ColumnDefinition/>
          </Grid.ColumnDefinitions>
          <TextBlock Grid.Row="0" Grid.Column="0" Text="First Name:"/>
          <TextBlock Grid.Row="0" Grid.Column="1" Text="{Binding Path=FirstName}"/>
          <TextBlock Grid.Row="1" Grid.Column="0" Text="Last Name:"/>
          <TextBlock Grid.Row="1" Grid.Column="1" Text="{Binding Path=LastName}"/>
          <TextBlock Grid.Row="2" Grid.Column="0" Text="Home Town:"/>
          <TextBlock Grid.Row="2" Grid.Column="1" Text="{Binding Path=HomeTown}"/>
        </Grid>
      </Border>
    </DataTemplate>
    <!--</SnippetDetailTemplate>-->
    
    <!--<SnippetUI>-->
  </Window.Resources>

  <StackPanel>
    <TextBlock FontFamily="Verdana" FontSize="11"
               Margin="5,15,0,10" FontWeight="Bold">My Friends:</TextBlock>
    <ListBox Width="377" IsSynchronizedWithCurrentItem="True"
             ItemsSource="{Binding Source={StaticResource MyFriends}}"/>
    <TextBlock FontFamily="Verdana" FontSize="11"
               Margin="5,15,0,5" FontWeight="Bold">Information:</TextBlock>
    <ContentControl Content="{Binding Source={StaticResource MyFriends}}"
                    ContentTemplate="{StaticResource DetailTemplate}"/>
        <WrapPanel>
            <Button Height="23" Name="addPerson" Width="75" Click="addPerson_Click">Add Person</Button>
            <Button Height="23" Name="editPerson" Width="75" Click="editPerson_Click">Edit Person</Button>
        </WrapPanel>
    </StackPanel>
</Window>
<!--</SnippetUI>-->